package com.hmall.controller;

import com.hdmall.business.common.common.ServerResponse;
import com.hmall.service.VisitorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName VisitorController
 * @Description
 * @Author zhoutao
 * @Date 2018/11/27 14:29
 * @Version 2.0
 **/
@RequestMapping("/visitor/")
@RestController
@Api(value = "游客API")
public class VisitorController {

    @Autowired
    VisitorService visitorService;


    @ApiOperation("记录游客信息")
    @PostMapping("recordInformation")
    public ServerResponse recordInformation(String nickName, String province, String city, String county, String phone){

        return visitorService.recordInformation(nickName, province, city, county, phone);
    }

    @GetMapping("getVisitorInformation")
    @ApiOperation("得到游客信息列表")
    public ServerResponse getVisitorInformation(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum, @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize){

        return visitorService.getVisitorInformation(pageNum, pageSize);
    }
}
